package com.loan.web.api;

import com.loan.entity.Process;
import com.loan.entity.ResponseResult;
import com.loan.group.ProcessAddGroup;
import com.loan.service.ProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: ProcessController
 * @Description: 申请流转表数据响应
 * @Author: wYin
 * @Date: 2022/1/17 22:19
 */
@SuppressWarnings("all")
@RestController
@RequestMapping("/api/process")
public class ProcessController {
    @Autowired
    private ProcessService processService;

    /**
     * @Desc: 接收JSON数据，添加流程表
     * @Param: [process]
     * @Return: com.loan.entity.ResponseResult<java.lang.Void>
     * @Author: wYin
     * @Date: 2022/1/19 9:40
     */
    @PostMapping("/add")
    public ResponseResult<Void> add(@RequestBody @Validated({ProcessAddGroup.class}) Process process){
        boolean flag = processService.insert(process);
        if(flag){
            return ResponseResult.SUCCESS;
        }
        return ResponseResult.FAIL;
    }

}
